<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('审批管理')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
							状态：<select name="cState" th:with="type=${@dict.getType('sys_normal_disable')}">
						            <option value="">全部</option>
									<option value="已上报">已上报</option>
									<option value="受理退回">受理退回</option>
									<option value="审查中">审查中</option>
									<option value="审查退回">审查退回</option>
									<option value="审批通过">审批通过</option>
							    </select>
							</li>
							<li>
                                <p>工程名称：</p>
                                <input type="text" name="unitEngineeringName"/>
                            </li>
                            <li>
                                <p>施工单位：</p>
                                <input type="text" name="totalCompany"/>
                            </li>
                            <li>
                                <p>监理单位：</p>
                                <input type="text" name="supervisionUnit"/>
                            </li>
                            <li>
							项目类型：<select name="projectType" th:with="type=${@dict.getType('sys_normal_disable')}">
						            <option value="">全部</option>
									<option value="私人住宅">私人住宅</option>
									<option value="商品住宅">商品住宅</option>
									<option value="廉租住房">廉租住房</option>
									<option value="公共租赁住房">公共租赁住房</option>
									<option value="经济适用住房">经济适用住房</option>
									<option value="限价商品住房">限价商品住房</option>
									<option value="城市棚户区改造安置房">城市棚户区改造安置房</option>
									<option value="国有工矿棚户区改造安置房">国有工矿棚户区改造安置房</option>
									<option value="国有林场危旧房改造">国有林场危旧房改造</option>
									<option value="公共租赁住房">国有垦区危房改造</option>
									<option value="公共建筑（医院、学校、剧场等）">公共建筑（医院、学校、剧场等）</option>
									<option value="商住一体楼">商住一体楼</option>
									<option value="其他市政配套基础设施工程">其他市政配套基础设施工程</option>
									<option value="市政管线工程">市政管线工程</option>
									<option value="市政道路工程">市政道路工程</option>
									<option value="厂房">厂房</option>
									<option value="公共建筑（医院、学校、剧场等）">装饰装修工程</option>
									<option value="商铺">商铺</option>
									<option value="商业写字楼">商业写字楼</option>
									<option value="其他">其他</option>
							    </select>
							</li>
							<li class="select-time">
                                <p>上报日期：</p>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="reportTimeBegin"/>
                                <span>至</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="reportTimeEnd"/>
                            </li> 
                            <li class="select-time">
                                <p>发证日期：</p>
                                <input type="text" class="time-input" id="startTime1" placeholder="开始时间" name="issueDateBegin"/>
                                <span>至</span>
                                <input type="text" class="time-input" id="endTime1" placeholder="结束时间" name="issueDateEnd"/>
                            </li> 
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>
            <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="conpermit:reviewrecord:export">
		            <i class="fa fa-download"></i> 导出
		        </a>
	        </div>
            <div class="col-sm-12 select-table table-striped">
                 <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:src="@{/js/plugins/datetime/moment.js}"></script>
    <script th:inline="javascript">
    var applyFlag = [[${@permission.hasPermi('conpermit:reviewrecord:apply')}]];
    var changeFlag = [[${@permission.hasPermi('conpermit:reviewrecord:change')}]];
    var logFlag = [[${@permission.hasPermi('conpermit:reviewrecord:log')}]];
    var certFlag = [[${@permission.hasPermi('conpermit:reviewrecord:cert')}]];
    
    var prefix = ctx + "conpermit/reviewrecord";
    var conpermitApplyPrefix = ctx + "conpermit/conpermit";
    var enterPriseprefix = ctx + "enterprise/enterprise";
    
    $(function() {
    	 var options = {
    			url: prefix + "/list",
                updateUrl: prefix + "/edit/{id}",
                exportUrl: prefix + "/export",
                detailUrl: conpermitApplyPrefix + "/detail/{id}",
                detailOneUrl: prefix + "/changeTable/{id}",
                detailQuaUrl: prefix + "/certificateDetail/{id}",
                detailThreeUrl: enterPriseprefix + "/bulidUnitDetail/{id}",
                detailFiveUrl: enterPriseprefix + "/detail/{id}",
                detailSixUrl: prefix + "/conpermitJournal/{id}",
                modalName: "审查记录 ",
                columns: [{
                        field: 'id',
                        title: '序号',
						formatter: function (value, row, index) {
						
						    return index + 1;
						}
                    },
                    {
                        field: 'guid',
                        title: '施工许可标识符',
						visible: false
	                },
                    {
                        field: 'unitEngineeringName',
                        title: '工程名称'
	                }, 
					{
                        field: 'projectCityNum',
                        title: '市县',
						width: 60
                    },
                    {
                        field: 'constructUnitId',
                        title: '建设单位标识符',
						visible: false
                    },
                    {
                        field: 'constructUnit',
                        title: '建设单位',
						formatter: function (value, row, index) {
							var actions = [];
							if(!$.common.isEmpty(value) && !$.common.isEmpty(row.constructUnitId)){
								actions.push('<a href="javascript:void(0)" onclick="$.operate.detailTabRewriteThree(\'' + value + '\',\''+ row.constructUnitId +'\')">'+value+'</a> ');
								return actions.join('');
							}
						}
                    },
                    {
                        field: 'totalCompany',
                        title: '施工单位',
						visible: false
                    },
                    {
                        field: 'totalCompanyGuid',
                        title: '施工单位标识符',
						visible: false
	                },
                    {
                        field: 'totalCompanyName',
                        title: '施工单位',
						formatter: function (value, row, index) {
							var actions = [];
							if(!$.common.isEmpty(value) && !$.common.isEmpty(row.totalCompanyGuid)){
								actions.push('<a href="javascript:void(0)" onclick="$.operate.detailTabRewriteFive(\'' + value + '\',\''+ row.totalCompanyGuid +'\')">'+value+'</a> ');
								return actions.join('');
							}
						}
	                },
                    {
                        field: 'reportTime',
                        title: '上报日期',
						width: 80,
						formatter: function (value, row, index) {
							if(value == '' || value == null){
								return value;
							}else{
								return moment(value).format('YYYY-MM-DD');	
							}
						}
                    },
					{
                        field: 'cstate',
                        title: '状态',
						width: 80
	                },
					{
	                    field: 'opera',
	                    title: '功能区',
                        formatter: function (value, row, index) {
                            var actions = [];
							actions.push('<a class="btn btn-success btn-xs ' + applyFlag + '" href="javascript:void(0)" onclick="$.operate.detailQYTabRewrite(\'' + row.guid + '\',\'' + row.unitEngineeringName + '施工许可申请表\')"><i class="fa fa-edit"></i>申请表</a> ');
							actions.push('<a class="btn btn-success btn-xs ' + changeFlag + '" href="javascript:void(0)" onclick="$.operate.detailTabRewriteOne(\'' + "变更列表" + '\',\'' + row.guid + '\')"><i class="fa fa-edit"></i>变更</a> ');
							actions.push('<a class="btn btn-success btn-xs ' + logFlag + '" href="javascript:void(0)" onclick="$.operate.detailTabRewriteSix(\'' + "日志" + '\',\'' + row.guid + '\')"><i class="fa fa-edit"></i>审批日志</a> ');
							/* actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.detailTabRewriteOne(\'' + "变更列表" + '\',\'' + row.guid + '\')"><i class="fa fa-edit"></i>进入项目部管理</a> '); */
							if(row.cstate == '审批通过'){
								actions.push('<a class="btn btn-success btn-xs ' + certFlag + '" href="javascript:void(0)" onclick="$.operate.detailQua(\'' + "证书" + '\',\'' + row.guid + '\')"><i class="fa fa-edit"></i>证书</a> ');
							}
                            return actions.join('');
	                       }
	                }]
        };
    	$.table.init(options);
    });
    </script>
</body>
</html>